import request from '@/utils/request.ts'
import lodash from 'lodash'

const baseURL = '/dailyRecord'

/**
 * @name 接收学习时间记录
 * @description 需要做参数校验
 */
function newRecord(data: any) {
  return request({
    method: 'POST',
    url: `${baseURL}/newRecord`,
    // 把空字段过滤掉
    data: lodash.pickBy(data, item => item)
  })
}

/**
 * @name 查询学习记录
 * @description 查询学习记录
 */
function records(data: any) {
  return request({
    method: 'POST',
    url: `${baseURL}/records/${data.userId}/${data.pageNum}/${data.pageSize}`
  })
}

export default {
  newRecord,
  records
}
